-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api] Add new /content_summary public api #3620
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I just want to hear what @Harshg999 and @JohanAhlen thinks of the _normalize_path before we merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost, I've added few review comments
response['summary'] = stats.summary | ||
except WebHdfsException as e: | ||
raise Exception(_('Failed to fetch content summary for "%s". ') % path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should log e (especially e.message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception (all cascading calls too) will get added in stack trace when the exception occurs. @JohanAhlen - Should we add a better log message separately?
837f63c
to
adac138
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting there!
def content_summary(request, path): | ||
path = _normalize_path(path) | ||
response = {'summary': None} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now thinking we don't need to set it here. What if for all bad cases response is {}
but for the good cases we send response = {'summary': summary}
. (line 150)
Looks a bit more cleaner to handle in the UI, what do you think?
|
||
if not path: | ||
raise Exception(_('Path parameter is required to fetch content summary')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Add . in the end?
adac138
to
1add954
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
* [api] Add new /content_summary public api (cherry picked from commit 55ab28d) (cherry picked from commit bce57833b09cb018419cb700af9940bd2ea917f6) Change-Id: I56732633cc044f4750248ee482a8acd2180ac7b3 (cherry picked from commit 84322ed2bf17133db8904f434e195a79f72ee424)
What changes were proposed in this pull request?
How was this patch tested?
Please review Hue Contributing Guide before opening a pull request.